/*
 * @Author: Clark
 * @Email: haixuanwoTxh@gmail.com
 * @Date: 2023-01-04 15:37:01
 * @LastEditors: Clark
 * @LastEditTime: 2023-01-04 15:39:45
 * @Description: file content
 */

#include "apue.h"

int main()
{
    struct stat statbuf;
    if (stat("foo", &statbuf) < 0)
    {
        err_sys("stat error for foo");
    }

    if (chmod("foo", (statbuf.st_mode & ~S_IXGRP) | S_ISGID) < 0)
    {
        err_sys("chmod error for foo");
    }

    if (chmod("bar", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) < 0)
    {
        err_sys("chmod error for bar");
    }

    exit(0);
}
